<!doctype html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>留言板</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="container py-4">
<nav class="mb-4">
  <a class="btn btn-outline-primary" href="{{ url_for('index') }}">留言板</a>
  {% if current_user.is_authenticated %}
    <span class="ms-3">欢迎 {{ current_user.username }}
      {% if current_user.is_admin %}
        <a class="btn btn-sm btn-warning ms-2" href="{{ url_for('admin') }}">管理</a>
      {% endif %}
      <a class="btn btn-sm btn-secondary ms-2" href="{{ url_for('logout') }}">退出</a>
    </span>
  {% else %}
    <a class="btn btn-outline-success ms-2" href="{{ url_for('login') }}">登录</a>
    <a class="btn btn-outline-info" href="{{ url_for('register') }}">注册</a>
  {% endif %}
</nav>
{% with msgs = get_flashed_messages() %}
  {% if msgs %}
    <div class="alert alert-warning">{{ msgs[0] }}</div>
  {% endif %}
{% endwith %}
{% block content %}{% endblock %}
</body></html>